
<?php
	
    $provincias = array(
    '2' =>'&Aacute;lava',
    '3' =>'Albacete',
    '4' =>'Alicante/Alacant',
    '5' =>'Almer&iacute;a',
    '6' =>'Asturias',
    '7' =>'&Aacute;vila',
    '8' =>'Badajoz',
    '9' =>'Barcelona',
    '10' =>'Burgos',
    '11' =>'C&aacute;ceres',
    '12' =>'C&aacute;diz',
    '13' =>'Cantabria',
    '14' =>'Castell&oacute;n/Castell&oacute;',
    '15' =>'Ceuta',
    '16' =>'Ciudad Real',
    '17' =>'C&oacute;rdoba',
    '18' =>'Cuenca',
    '19' =>'Girona',
    '20' =>'Las Palmas',
    '21' =>'Granada',
    '22' =>'Guadalajara',
    '23' =>'Guip&uacute;zcoa',
    '24' =>'Huelva',
    '25' =>'Huesca',
    '26' =>'Illes Balears',
    '27' =>'Ja&eacute;n',
    '28' =>'A Coru&ntilde;a',
    '29' =>'La Rioja',
    '30' =>'Le&oacute;n',
    '31' =>'Lleida',
    '32' =>'Lugo',
    '33' =>'Madrid',
    '34' =>'M&aacute;laga',
    '35' =>'Melilla',
    '36' =>'Murcia',
    '37' =>'Navarra',
    '38' =>'Ourense',
    '39' =>'Palencia',
    '40' =>'Pontevedra',
    '41' =>'Salamanca',
    '42' =>'Segovia',
    '43' =>'Sevilla',
    '44' =>'Soria',
    '45' =>'Tarragona',
    '46' =>'Santa Cruz de Tenerife',
    '47' =>'Teruel',
    '48' =>'Toledo',
    '49' =>'Valencia/Val&eacute;ncia',
    '50' =>'Valladolid',
    '51' =>'Vizcaya',
    '52' =>'Zamora',
    '53' =>'Zaragoza'
    );
    
    
    $escuela_guid = get_input('escuela_guid', false);
    
    if ($escuela_guid){
    	$escuela = get_entity($escuela_guid);
    	$tipo = $escuela->getSubtype();
    	if (!strcmp('escuela', $tipo)){
    		//set_input('escuela_guid', $escuela_guid);
    		echo "<input type='hidden' name='escuela_guid' value='" . $escuela_guid . "'>";
    		echo "<div style='float:right'><img src='" . $escuela->getIconURL('large') . "'></div>";
    		$editar = true;
    	}else
    		forward(REFERER);
    }
?>
<style>
.cuerpo{
	padding: 2px;
}
</style>

<div class="cuerpo">
    <label><?php echo "<h4>" . elgg_echo('climbia:upload:image') . "</h4>";?></label>
    <div style='width:50%;'><?php echo elgg_view("input/file",array('name' => 'icon')); ?></div>
</div>
 
<div class="cuerpo">
    <label><?php echo "<h4>" . elgg_echo('name') . "</h4>"; ?></label>
    <?php //echo elgg_view('input/text',array('name' => 'nombre')); ?>
    <input type="text" name="nombre" <?php if ($editar) echo "value='" . $escuela->title . "'";  ?> style="width:350px;">
</div>

<div class="cuerpo">
    <label><?php echo "<h4>" . elgg_echo('climbia:location') . "</h4>"?> </label>
    <input type="text" name="location" <?php if ($editar) echo "value='" . $escuela->location . "'";  ?> style="width:350px;">
</div>


<div style='margin-top: 25px; height: 90px;'>
<div style='float:left; margin-right: 40px;'>
<div class="cuerpo">
    <label><?php echo "<h4>" .  elgg_echo('climbia:province') . "</h4>";?></label>
    <?php echo elgg_view('input/dropdown',array('name' => 'provincia', 'value' => $escuela->provincia ,'options' => $provincias)); ?>
</div>

<div class="cuerpo">
    <label><?php echo "<h4>" . elgg_echo('climbia:typeofrock') . "</h4>";?></label>
    <?php //echo elgg_view('input/dropdown',array('name' => 'tipoRoca', 'options' => $tipoRoca)); ?>
    <?php $tipoRoca = $escuela->tipoRoca?> 
    <select name="tipoRoca">
    <option <?php if (!strcmp('climbia:limestone', $tipoRoca)) echo "selected";?> value="climbia:limestone"><?php echo elgg_echo('climbia:limestone');?></option>
    <option <?php if (!strcmp('climbia:granite', $tipoRoca)) echo "selected";?> value="climbia:granite"><?php echo elgg_echo('climbia:granite');?></option>
    <option <?php if (!strcmp('climbia:volcanic', $tipoRoca)) echo "selected";?> value="climbia:volcanic"><?php echo elgg_echo('climbia:volcanic');?></option>
    <option <?php if (!strcmp('climbia:sandstone', $tipoRoca)) echo "selected";?> value="climbia:sandstone"><?php echo elgg_echo('climbia:sandstone');?></option>
    <option <?php if (!strcmp('climbia:conglomerate', $tipoRoca)) echo "selected";?> value="climbia:conglomerate"><?php echo elgg_echo('climbia:conglomerate');?></option>
    <option <?php if (!strcmp('climbia:otherclass', $tipoRoca)) echo "selected";?> value="climbia:otherclass"><?php echo elgg_echo('climbia:otherclass');?></option>
    </select>
</div>
</div>
<div class="cuerpo">
    <label><?php echo "<h4>" . elgg_echo('climbia:equipment'). "</h4>"?></label>
    <?php //echo elgg_view('input/checkboxes',array('name' => 'equipamiento', 'options' => $equipamiento, 'align' => 'horizontal')); ?>
    <ul class="elgg-input-checkboxes elgg-horizontal">
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:sportclimbing', $escuela->sportclimbing)) echo "checked";?> NAME="climbia:sportclimbing" VALUE="yes"><?php echo elgg_echo('climbia:sportclimbing')?></label></li>
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:bouldering', $escuela->bouldering)) echo "checked";?> NAME="climbia:bouldering" VALUE="yes"><?php echo elgg_echo('climbia:bouldering')?></label></li>
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:traditional', $escuela->traditional)) echo "checked";?> NAME="climbia:traditional" VALUE="yes"><?php echo elgg_echo('climbia:traditional')?></label></li>
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:artificial', $escuela->artificial)) echo "checked";?> NAME="climbia:artificial" VALUE="yes"><?php echo elgg_echo('climbia:artificial')?></label></li>
    </ul>
</div>

<div style='margin-top: 5px;' class="cuerpo">
    <label><?php  echo "<h4>" . elgg_echo('climbia:besttime') . ":</h4>";?></label>
    <?php //echo elgg_view('input/checkboxes',array('name' => 'mejorEpoca', 'options' => $estaciones, 'align' => 'horizontal')); ?>
    <ul class="elgg-input-checkboxes elgg-horizontal">
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:spring', $escuela->spring)) echo "checked";?> NAME="climbia:spring" VALUE="yes"><?php echo elgg_echo('climbia:spring')?></label></li>
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:summer', $escuela->summer)) echo "checked";?> NAME="climbia:summer" VALUE="yes"><?php echo elgg_echo('climbia:summer')?></label></li>
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:fall', $escuela->fall)) echo "checked";?> NAME="climbia:fall" VALUE="yes"><?php echo elgg_echo('climbia:fall')?></label></li>
    <li><label><INPUT TYPE="checkbox" <?php if (!strcmp('climbia:winter', $escuela->winter)) echo "checked";?> NAME="climbia:winter" VALUE="yes"><?php echo elgg_echo('climbia:winter')?></label></li>
    </ul>
</div>
 </div>
<div>
    <label><?php echo "<h4>" . elgg_echo('description') . "</h4>"; $des = $escuela->description; ?></label>
    <?php echo elgg_view('input/longtext',array('name' => 'descripcion', 'value' => $des)); ?>
</div>
 
<div>
    <label><?php echo "<h4>" . elgg_echo('access') . "</h4>";$acceso = $escuela->acceso;?></label>
    <?php echo elgg_view('input/longtext',array('name' => 'acceso', 'value' => $acceso)); ?>
</div>
<div>
    <?php echo elgg_view('input/submit', array('value' => 'Guardar')); ?>
</div>